// reducer 负责初始化state 和修改state
import { ADD_TODO, DEL_TODO, SET_TEXT, PLUS_COUNT, TOGGLE_ITEM } from '../actions/actionType'
import { combineReducers } from 'redux'
import text from './textReducer'
import todos from './todoRecucer'
import list from './FetchTodo'
// 初始化化state 

// 整个todoList的 操作方法的actions处理
// reducer 处理函数有俩个形参 一个state 一个action
// reducer 处理actions的描述的功能
// 用新的改变 去替换 原来的state
const count = (state = 1, action) => {
  console.log(action)
  console.log(88888)
  switch (action.type) {
    case PLUS_COUNT:
      let cc = state.count + action.num;
      return {
        ...state,
        count: cc
      }
      break;
    default:
      return state  //默认返回所有的state
  }
}

export default combineReducers({
  text,
  todos,
  count,
  list
})
